Skip to main content

defaultStack

Type

property

Summary

Specifies which stack the expression this stack evaluates to, if no stack is specified in a statement.

Syntax

set the defaultStack to <stackName>

Description

Use the defaultStack property to ensure that actions are performed on the correct stack.

If no stack is specified in a statement that applies to a stack, LiveCode assumes the defaultStack is the stack meant. For example, the following statement causes the defaultStack to move to its next card :

    go next card -- of the current defaultStack

The expression this card refers to the current card of the defaultStack.

Important

You cannot use a stack reference, only a stack name or an expression that evaluates to a stack name. For example, the following statement causes an error :

    set the defaultStack to stack \"Hmm\" -- WON\'T WORK

but the following statements are correct:

    set the defaultStack to \"Hmm\"
set the defaultStack to (\"stack\" && quote & \"Hmm\" & quote)

The defaultStack property is particularly useful in stacks opened in a mode other than an editable window (such as stacks that are being used as dialog boxes, palettes, or menus). LiveCode's message box and editing palettes set the defaultStack property to the value returned by the topStack function before performing a stack action.

Examples

set the defaultStack to "Help"
set the defaultStack to the topStack

function: topStack, stacks, menus, value, clickStack, mainStacks

glossary: property, palette, error, return, editable window, statement, expression, evaluate, object reference, dialog box

keyword: card, message box

message: shutdown

object: stack

property: name

command: call, import

control structure: function

Compatibility and Support

Introduced

LiveCode 1.0

OS

mac

windows

linux

ios

android

Platforms

desktop

server

mobile

Thank you for your feedback!

Was this page helpful?